/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package p;

import java.sql.*;

/**
 *
 * @author João
 */
public class ConnectionServerDB extends Thread {

    private Connection con;
    private String url = "jdbc:mysql://localhost:3306/mysql";
    private String username = "root";
    private String pass = "";
    private double time;
    private int number;
    private PreparedStatement stmt;
    private int id = 0;

    ConnectionServerDB() {
    }

    public void run() {
     System.out.println("corri");

        try {

            Class.forName("com.mysql.jdbc.Driver").newInstance();

            con = DriverManager.getConnection(url, username, pass);

             stmt= con.prepareStatement("show databases;");

                try {
                   String s= stmt.executeQuery().toString();
         System.out.println(s);
                } catch (Exception e) {
                    System.out.println("Error when setting transaction isolation level " + e.getMessage());
                }

            stmt.close();
            con.close();

        } catch (Exception e) {
            System.out.println("ERROR in MyThread: " + e);
            e.printStackTrace();
        }
    }
}
